<template>
  <view class="announcement" :style="{paddingTop:statusBarHeight+'px'}">
    <uni-nav-bar  :border="false" left-icon="left" title="公告" @clickLeft="back" />
	
	<view class="content">
		<view class="title">{{info?.title}}</view>
		
		<view class="author"> {{info?.author}}  {{dayjs(info?.publish_date || 0).format('YYYY-MM-DD HH:mm:ss')}}</view>
		
		<view class="desc" v-html="info?.content"></view>
		
		<view class="read">阅读 {{info?.view_count}}</view>
	</view>
	
  </view>
</template>

<script setup>
import { request } from '../../utils';
import dayjs from 'dayjs';
const statusBarHeight = ref(uni.getSystemInfoSync().statusBarHeight)
const info = ref(null)

const back= ()=>{
	uni.navigateBack()
}

const getAnnouncementById = (id)=>{
	request({
		url:"https://tea.qingnian8.com/api/bizhi/wallNewsDetail",
		data:{
			id
		}
	}).then(res=>{
		info.value = res.data
	})
}
onLoad((e)=>{
	getAnnouncementById(e.id)
})
</script>

<style lang="scss" scoped>
.announcement{
	.content{
		margin-top: 15rpx;
		padding: 0 40rpx;
		.title{
			font-size: 36rpx;
			margin: 45rpx 0;
		}
		.author,.read{
			color: #999;
			font-size: 22rpx;
			margin: 30rpx 0;
		}
	}
}
</style>
